package JavaAssignment;
import java.io.*;
import java.util.*;

public class ListNode implements Serializable{

  private ListNode next = null;
  private Object data = null;

  public ListNode(Object obj) {
    this(obj, null);
  }

  public ListNode(Object obj, ListNode nextNode) {
    data = obj;
    next = nextNode;
  }

  public boolean setData(Object newData) {
    if (newData != null) {
      data = newData;
      return true;
    }
    else {
      return false;
    }
  }

  Object getData() {
    return data;
  }

  public boolean setNext(ListNode next) {
    if (next != null) {
      this.next = next;
      return true;
    }
    else {
      return false;
    }
  }

  public ListNode getNext() {
    return next;
  }
}
